<template>
    <el-container>
        <el-main>
            <div id='formPreview' class="formPreview"></div>
        </el-main>
        <el-footer>
            <el-button>同意</el-button>
            <el-button>不同意</el-button>
        </el-footer>
    </el-container>
</template>

<script>
    import AllComponents from 'formiojs/components';
    import Components from 'formiojs/components/Components';
    import FormIoForm from 'formiojs/Form';
    import 'formiojs/dist/formio.full.min.css'
    import {getFormDefine} from '../../api/task.api'
    Components.setComponents(AllComponents);
    export default {
        name: "TaskApprove",
        data() {
            return {
                formIo: null
            }
        },
        computed: {
            taskId: function () {
                return this.$store.state.approveTaskId;
            }
        },
        mounted() {
            if (this.taskId) {
                getFormDefine('jtyy-apply-form').then((res) => {
                    new FormIoForm(document.getElementById('formPreview'), res.model, {
                        readOnly: true
                    }).ready.then((instance) => {
                        this.formIo = instance;
                        instance.submission = {
                            data: {
                                'desc': '哈哈'
                            }
                        };
                    });
                })
            }
        }
    }
</script>

<style scoped>
    .el-footer {
        text-align: center;
    }
</style>
